onEvent('recipes', event => {
    event.stonecutting('quark:marble', 'astralsorcery:marble_raw')
    event.stonecutting('quark:marble_bricks_vertical_slab', 'astralsorcery:marble_raw')
    let color_list = [
        'quark:indigo_crystal',
        'quark:blue_crystal',
        'quark:green_crystal',
        'quark:yellow_crystal',
        'quark:orange_crystal',
        'quark:red_crystal',
        'quark:black_crystal',
        'quark:white_crystal',
        'quark:violet_crystal',
    ];


    let color = [
        'quark:indigo_crystal',
        'quark:blue_crystal',
        'quark:green_crystal',
        'quark:yellow_crystal',
        'quark:orange_crystal',
        'quark:red_crystal',
        'quark:black_crystal',
        'quark:white_crystal',
    ];

    let color1 = [
        'quark:orange_crystal',
        'quark:black_crystal',
        'quark:white_crystal',
        'quark:red_crystal',
    ];



    const research_station1_ST = [
        [
            "aaaaa",
            "aaaaa",
            "aaaaa",
            "aaaaa",
            "aaaaa",
        ],
        [
            " bab ",
            "b   b",
            "a m a",
            "b   b",
            " bab ",
        ],
        [
            "  c  ",
            "     ",
            "c e c",
            "     ",
            "  c  ",
        ],
        [
            "  d  ",
            "  e  ",
            "defed",
            "  e  ",
            "  d  ",
        ],
        [
            "  c  ",
            "     ",
            "c e c",
            "     ",
            "  c  ",
        ],
        [
            "  b  ",
            "  b  ",
            "bbbbb",
            "  b  ",
            "  b  ",
        ]
    ];

    // 定义材料映射
    const research_station1_MM = {
        "a": 'astralsorcery:marble_arch',
        "b": 'astralsorcery:marble_slab',
        "c": 'astralsorcery:marble_pillar',
        "d": 'astralsorcery:marble_engraved',
        "e": 'minecraft:end_rod',
        "f": 'quark:black_crystal'
    };

    const research_table1_ST = [
        [
            "     ",
            "  a  ",
            "     ",
            "abmba"
        ],
        [
            "     ",
            "  d  ",
            "     ",
            "feeef"
        ],
        [
            "     ",
            "     ",
            "     ",
            "feeef"
        ],
        [
            "     ",
            "     ",
            "     ",
            "bbbbb"
        ],
    ];

    const research_table1_MM = {
        "a": 'astralsorcery:marble_arch',
        "b": 'astralsorcery:marble_slab',
        "d": 'kubejs:coarse_block',
        "e": 'tconstruct:clear_glass_pane',
        "f": 'quark:marble_bricks_vertical_slab'
    }
    for (let i = 0; i < color.length; i++) {
        let j = (i + 1) % color.length;
        event.recipes.custommachinery.custom_machine("custommachinery:research_station1", 10)
            .requireFluid(Fluid.of('manaliquidizer:mana_fluid', 5))
            .produceItem('kubejs:item_19').chance(0.2)
            .produceItem('kubejs:item_20').chance(0.05)
            .requireStructure(research_station1_ST, {
                "a": 'astralsorcery:marble_arch',
                "b": 'astralsorcery:marble_slab',
                "c": 'astralsorcery:marble_pillar',
                "d": 'astralsorcery:marble_engraved',
                "e": 'minecraft:end_rod',
                "f": color[i]
            })
            .runCommandOnEnd(`/setblock ~ ~2 ~ ${color[j]}`, false).chance(0.9999)
            .runCommandOnEnd(`/setblock ~ ~2 ~ quark:violet_crystal`, false).chance(0.01)
    }





    for (let i = 0; i < color1.length; i++) {
        let j = (i + 1) % color1.length;
        event.recipes.custommachinery.custom_machine("custommachinery:research_station1", 10)
            .requireFluid(Fluid.of('astralsorcery:liquid_starlight', 5))
            .produceItem('kubejs:item_19').chance(0.05)
            .requireStructure(research_station1_ST, {
                "a": 'astralsorcery:marble_arch',
                "b": 'astralsorcery:marble_slab',
                "c": 'astralsorcery:marble_pillar',
                "d": 'astralsorcery:marble_engraved',
                "e": 'minecraft:end_rod',
                "f": color1[i]
            })
            .runCommandOnEnd(`/setblock ~ ~2 ~ ${color1[j]}`, false).chance(0.99)
            .runCommandOnEnd(`/setblock ~ ~2 ~ quark:yellow_crystal`, false).chance(0.001)
            .runCommandOnEnd('/setblock ~ ~2 ~ kubejs:polluted_dirt', false).chance(0.009)
    }

    event.recipes.custommachinery.custom_machine("custommachinery:research_station1", 10)
        .requireFluid(Fluid.of('manaliquidizer:mana_fluid', 50))
        .produceItem('kubejs:item_19')
        .produceItem('kubejs:item_20').chance(0.5)
        .requireStructure(research_station1_ST, {
            "a": 'astralsorcery:marble_arch',
            "b": 'astralsorcery:marble_slab',
            "c": 'astralsorcery:marble_pillar',
            "d": 'astralsorcery:marble_engraved',
            "e": 'minecraft:end_rod',
            "f": 'quark:violet_crystal'
        })



    const CO_ST = [["     ", "     ", "  a  ", " zbz ", "cbdbe", " zbz ", "  m  "], ["     ", "     ", "     ", " f f ", " cge ", " fhf ", "     "], ["     ", "     ", "     ", "  i  ", " jkl ", "  n  ", "     "], ["     ", "     ", "  i  ", " jkl ", "  h  ", "     ", "     "], ["     ", "  i  ", " jkl ", "  h  ", "     ", "     ", "     "], ["  i  ", " jkl ", "  h  ", "     ", "     ", "     ", "     "], [" jkl ", "  h  ", "     ", "     ", "     ", "     ", "     "]];
    const CO_MM = { "a": "astralsorcery:marble_stairs[facing=south,half=bottom,shape=straight,waterlogged=false]", "b": "minecraft:diamond_block", "c": "astralsorcery:marble_stairs[facing=east,half=bottom,shape=straight,waterlogged=false]", "d": "astralsorcery:marble_pillar[pillartype=bottom,waterlogged=false]", "e": "astralsorcery:marble_stairs[facing=west,half=bottom,shape=straight,waterlogged=false]", "f": "astralsorcery:marble_bricks", "g": "astralsorcery:marble_pillar[pillartype=top,waterlogged=false]", "h": "astralsorcery:marble_stairs[facing=north,half=bottom,shape=straight,waterlogged=false]", "i": "astralsorcery:marble_stairs[facing=south,half=top,shape=straight,waterlogged=false]", "j": "quark:marble_bricks_vertical_slab[type=west,waterlogged=false]", "k": "atum:crystal_glass", "l": "quark:marble_bricks_vertical_slab[type=east,waterlogged=false]", "n": "quark:marble_bricks_vertical_slab[type=south,waterlogged=false]", "z": 'astralsorcery:starmetal' };


    const ars_parchment_list = [

        {
            intput: 'kubejs:bombadil',
            output: Item.of('astralsorcery:constellation_paper', '{astralsorcery:{constellationName:"astralsorcery:armara"}}')
        },

        {
            intput: 'kubejs:zod',
            output: Item.of('astralsorcery:constellation_paper', '{astralsorcery:{constellationName:"astralsorcery:discidia"}}')
        },

    ]

    const ars_parchment_list_2 = [
        {
            intput: 'kubejs:fus',
            output: 'kubejs:paper_a_1'
        },
        {
            intput: 'kubejs:jita',
            output: 'kubejs:paper_a_2'
        },
        {
            intput: 'kubejs:tano',
            output: 'kubejs:paper_a_0'
        },
        {
            intput: 'botania:rune_fire',
            output: 'kubejs:paper_a_3'
        },
        {
            intput: 'botania:rune_water',
            output: 'kubejs:paper_a_4'
        },
        {
            intput: 'botania:rune_earth',
            output: 'kubejs:paper_a_5'
        },
        {
            intput: 'bloodmagic:corrupted_dust',
            output: 'kubejs:paper_a_6'
        },
        {
            intput: '64x minecraft:clock',
            output: 'kubejs:paper_a_7'
        }
    ]

    ars_parchment_list_2.forEach((i) => {
        event.recipes.custommachinery.custom_machine("custommachinery:constellation_observatory", 8000)
            .requireItem('astralsorcery:parchment')
            .requireItem('8x kubejs:paper_2')
            .requireItem(i.intput)
            .requireEnergy(20000)
            //.requireStructure(CO_ST, CO_MM)
            .produceItem(i.output)
            .requireTime([">=13000", "<<23000"])
            .requireWeather("clear")
    })

    ars_parchment_list.forEach((i) => {
        event.recipes.custommachinery.custom_machine("custommachinery:constellation_observatory", 8000)
            .requireItem('astralsorcery:parchment')
            .requireItem('8x kubejs:paper_2')
            .requireItem(i.intput)
            .requireEnergy(20000)
            //.requireStructure(CO_ST, CO_MM)
            .produceItem(i.output)
            .requireTime([">=13000", "<<23000"])
            .requireWeather("clear")
            .requireFunctionOnEnd(ctx => {
                ctx.machine.addItemToSlot(
                    "output2",
                    i.output,
                    false);
                return Result.success()
            })
    })

    event.recipes.custommachinery.custom_machine("custommachinery:constellation_observatory", 8000)
        .requireItem('astralsorcery:parchment')
        .requireItem('minecraft:clock')
        .requireTime([">=11000", "<<13000"])
        .requireEnergy(20000)
        .produceItem('kubejs:paper_foredawn')

    event.recipes.custommachinery.custom_machine("custommachinery:constellation_observatory", 8000)
        .requireItem('astralsorcery:parchment')
        .requireItem('minecraft:clock')
        .requireTime([">=0", "<<2000"])
        .requireEnergy(20000)
        .produceItem('kubejs:paper_foredawn')


    event.recipes.custommachinery.custom_machine("custommachinery:constellation_observatory", 8000)
        .requireItem('astralsorcery:parchment')
        .requireItem('minecraft:clock')
        .requireTime([">=13000", "<<23000"])
        .requireEnergy(20000)
        .produceItem('kubejs:paper_night')

    event.recipes.custommachinery.custom_machine("custommachinery:constellation_observatory", 8000)
        .requireItem('astralsorcery:parchment')
        .requireItem('minecraft:clock')
        .requireTime([">=2000", "<<11000"])
        .requireEnergy(20000)
        .produceItem('kubejs:paper_daytime')










    event.recipes.custommachinery.custom_machine("custommachinery:research_table1", 80)
        .requireItem('8x kubejs:item_19')
        .requireItem('bloodmagic:basemonstersoul')
        .produceItem('kubejs:paper_1')
    //.requireStructure(research_table1_ST, research_table1_MM)

    event.recipes.custommachinery.custom_machine("custommachinery:research_table1", 80)
        .requireItem('8x kubejs:item_19')
        .requireItem('astralsorcery:glass_lens')
        .requireItem('astralsorcery:stardust')
        .produceItem('kubejs:paper_2')
    // .requireStructure(research_table1_ST, research_table1_MM)

    event.recipes.custommachinery.custom_machine("custommachinery:research_table1", 80)
        .requireItem('16x kubejs:item_19')
        .requireItem('minecraft:quartz_block')
        .requireItem('evilcraft:vengeance_essence_materialized')
        .produceItem('kubejs:paper_3')
    //  .requireStructure(research_table1_ST, research_table1_MM)

    event.recipes.custommachinery.custom_machine("custommachinery:research_table1", 80)
        .requireItem('16x kubejs:item_19')
        .requireItem('betternether:cincinnasite_ingot')
        .produceItem('kubejs:paper_4')
    // .requireStructure(research_table1_ST, research_table1_MM)

    event.recipes.custommachinery.custom_machine("custommachinery:research_table1", 80)
        .requireItem('16x kubejs:item_19')
        .requireItem('botania:laputa_shard')
        .produceItem('kubejs:paper_5')

    // event.recipes.custommachinery.custom_machine("custommachinery:research_table1", 20)
    //     .requireItem('minecraft:coal_block')
    //     .produceItem(Item.of('minecraft:paper', "{display:{Name:'[{\"text\":\"你可以通过这种方式给机器添加能量\",\"color\":\"gold\",\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false},{\"text\":\"You can add energy to the machine in this way\",\"color\":\"yellow\",\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false}]'}}"))
    //     .produceEnergy(1000)

    // event.recipes.custommachinery.custom_machine("custommachinery:research_table1", 20)
    //     .requireFluid(Fluid.of('minecraft:lava', 500))
    //     .produceItem(Item.of('minecraft:paper', "{display:{Name:'[{\"text\":\"你可以通过这种方式给机器添加能量\",\"color\":\"gold\",\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false},{\"text\":\"You can add energy to the machine in this way\",\"color\":\"yellow\",\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false}]'}}"))
    //     .produceEnergy(1000)



    const star_map = [
        "evorsio",
        "aevitas",
        "vicio",
        "fornax",
        "octans",
        "bootes",
        "mineralis",
        "horologium"

    ]

    for (let i = 0; i < star_map.length; i++) {
        event.shapeless(
            Item.of('astralsorcery:constellation_paper',
                `{astralsorcery:{constellationName:"astralsorcery:${star_map[i]}"}}`),
            `kubejs:paper_a_${i}`
        );
    }

    event.recipes.custommachinery.custom_machine("custommachinery:bedrock_crusher", 800)
        .produceItem('bloodmagic:corrupted_tinydust')
        .requireStructure(['a', 'm'], {
            'a': 'minecraft:bedrock'
        })
    event.recipes.custommachinery.custom_machine("custommachinery:bedrock_crusher", 20)
        .produceItem('bloodmagic:corrupted_tinydust')
        .requireStructure(['a', 'm'], {
            'a': 'extendedcrafting:crystaltine_block'
        })

    //Item.of('custommachinery:custom_machine_item', '{machine:"custommachinery:pollution_purifier"}')
    event.recipes.custommachinery.custom_machine("custommachinery:pollution_purifier", 20000)
        .requireItem('kubejs:radionin_1')
        .giveEffectEachTick("minecraft:regeneration", 100, 50)

    event.recipes.custommachinery.custom_machine("custommachinery:pollution_purifier", 20000)
        .requireItem('kubejs:radionin_2')
        .giveEffectEachTick("huahuamagicconverter:radiation_resistance", 100, 50)

    event.recipes.custommachinery.custom_machine("custommachinery:pollution_purifier", 20000)
        .requireItem('kubejs:radionin_3')
        .giveEffectEachTick("huahuamagicconverter:complete_resistance", 100, 50)

});